package com.study.config;

import com.study.interceptor.MyInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName Mvcconfig
 * @Description TODO
 * @Author ThinkPad
 * @Date 2020/11/10 20:16
 * @Version 1.0
 **/
@Configuration
public class Mvcconfig implements WebMvcConfigurer {
    @Bean("myInterceptor")
    public MyInterceptor myInterceptor() {
        return new MyInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(new MyInterceptor()).addPathPatterns("/*");
    }
}
